package org.example.postgraduateproject.entity;

import java.util.Date;

public class Answer {
    private Integer answerId;
    private Integer questionId;
    private Integer userId;
    private String content;
    private Date createdAt;
    private Date updatedAt;
    private Boolean isAccepted;
    private Integer votes;

    // 无参构造函数
    public Answer() {}

    // 有参构造函数
    public Answer(Integer questionId, Integer userId, String content, Boolean isAccepted, Integer votes) {
        this.questionId = questionId;
        this.userId = userId;
        this.content = content;
        this.isAccepted = isAccepted;
        this.votes = votes;
    }

    // Getters 和 Setters
    public Integer getAnswerId() {
        return answerId;
    }

    public void setAnswerId(Integer answerId) {
        this.answerId = answerId;
    }

    public Integer getQuestionId() {
        return questionId;
    }

    public void setQuestionId(Integer questionId) {
        this.questionId = questionId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Boolean getIsAccepted() {
        return isAccepted;
    }

    public void setIsAccepted(Boolean accepted) {
        isAccepted = accepted;
    }

    public Integer getVotes() {
        return votes;
    }

    public void setVotes(Integer votes) {
        this.votes = votes;
    }

    @Override
    public String toString() {
        return "Answer{" +
                "answerId=" + answerId +
                ", questionId=" + questionId +
                ", userId=" + userId +
                ", content='" + content + '\'' +
                ", createdAt=" + createdAt +
                ", updatedAt=" + updatedAt +
                ", isAccepted=" + isAccepted +
                ", votes=" + votes +
                '}';
    }
}